import React, {useEffect, useState} from 'react';
import {useParams} from "react-router-dom";
import axios from "axios";

function Details(props) {
    const {id} = useParams()
    const [user,setUser] = useState({})
    useEffect(()=>{
        axios.get(`https://api.github.com/users/${id}`).then(({data})=>{
            setUser(data)
        })
    },[])
    return (
        <div>
            <h3>{user.name}的git详情页</h3>
            <img src={user.avatar_url} alt=""/>

        </div>
    );
}

export default Details;